/* ============================================================
   レイアウト調整：地図は常に背面全画面、パネルは前面浮遊
   ============================================================ */

/* --- ベースレイアウト --- */
body {
    overflow: hidden;
}

/* 地図: 常に全画面を維持（背面） */
#map {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100vh !important;
    z-index: 1;
}

/* タワーと断面図のコンテナを初期状態で隠す */
#tower-container, #section-view-container {
    display: none;
    position: absolute; /* 必要に応じて調整してください */
    /* ここに本来の定位置を指定 */
    top: 100px;
    left: 50px;
}

/* --- サイドパネル (シミュレーション) --- */
#floodAnimationStatus {
    position: fixed;
    z-index: 10000;
    /* ナビより前面 */
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: auto;
    overflow-x: hidden;
    display: none;
    flex-direction: column;
    resize: both;
}

/* elevationChart style moved to bottom for better overriding */

#floodAnimationStatus .anim-header {
    cursor: grab;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 1.0);
    /* 不透明にする */
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* --- ボトムパネル (断面図) ---
   表示/非表示はJS側で制御。ここでは位置とz-indexのみ補強。
   元のスタイルは hazard2026_style.css で定義済み。 */
#elevationChart .elevation-header {
    cursor: move;
}

#floodAnimationStatus.minimized,
#elevationChart.minimized {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    width: 320px !important;
    min-width: 320px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4) !important;
    transition: none;
    cursor: default;
    z-index: 10001 !important;
    left: auto !important;
    right: 20px !important;
    top: auto !important;
    resize: none !important;
}

#floodAnimationStatus.minimized>*:not(.anim-header),
#elevationChart.minimized>*:not(.elevation-header):not(.minimize-btn) {
    display: none !important;
}

#floodAnimationStatus:not(.minimized),
#elevationChart:not(.minimized) {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#elevationChart {
    z-index: 2200;
    max-width: 100vw;
    transition: transform 0.3s, opacity 0.3s;
    resize: both;
    overflow: hidden !important; /* Enable resize handle */
}

#elevationChart .elevation-header {
    position: relative !important;
    flex-shrink: 0;
    cursor: grab;
    padding: 12px 16px;
    min-height: 48px;
    background: #f1f5f9;
}

#elevationBody {
    position: static !important;
    /* 絶対配置を解除してFlexboxに従わせる */
    flex: 1 !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: white;
    padding: 10px;
    min-height: 0;
    /* Flexboxのはみ出し防止 */
}

/* --- ナビゲーションパネル調整 --- */
#navPanel {
    max-height: calc(100vh - 40px);
    z-index: 3000;
}

/* シミュレーション中はナビを隠す */
body.simulation-active #navPanel {
    display: none !important;
}

/* シミュレーション中の他UI調整 */
body.simulation-active .map-tools-container,
body.simulation-active .dist-tool-panel,
body.simulation-active .legend-draggable,
#mapStatus {
    display: none !important;
}

/* --- 断面図上の垂直同期ライン --- */
.chart-sync-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(239, 68, 68, 0.8);
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* 地図上の同期スポットライト */
.sync-spotlight {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.6) 0%, transparent 70%);
    border: 2px solid rgba(239, 68, 68, 0.9);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    animation: spotlight-pulse 1.5s infinite;
}

@keyframes spotlight-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }
}

/* レスポンシブ設定（モバイル時は全画面等） */
@media screen and (max-width: 768px) {
    #elevationChart {
        left: 10px !important;
        width: calc(100vw - 20px) !important;
        bottom: 10px !important;
    }

    #floodAnimationStatus {
        width: calc(100vw - 20px) !important;
        right: 10px !important;
    }
}

/* ============================================================
   モダン化：ボタン・フォント・アコーディオン改善
   高校生が使いやすい「アプリ感」を意識したスタイル
   ============================================================ */

/* プライマリ・サクセスボタン: 角丸拡大＋フォント16px */
.step-action-btn.primary,
.step-action-btn.success {
    border-radius: 14px !important;
    font-size: 16px !important;
    padding: 14px 12px !important;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* 汎用ボタン: 角丸を少し大きく */
.step-action-btn {
    border-radius: 12px !important;
}

/* アコーディオン (details/summary) の矢印アニメーション */
details>summary {
    cursor: pointer;
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary>span:first-child {
    display: inline-block;
    margin-right: 4px;
}

/* 地図切り替えボタン（ベースマップセレクター）のモダン化 */
.basemap-selector {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    margin-top: 10px;
}

.basemap-btn {
    padding: 16px 8px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.basemap-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
    opacity: 0.5;
}

.basemap-btn:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.basemap-btn.active {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border-color: #3b82f6 !important;
    color: #1e40af !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 12px 20px -5px rgba(59, 130, 246, 0.3) !important;
    transform: translateY(-2px);
}

.basemap-icon {
    font-size: 28px;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.basemap-btn:hover .basemap-icon {
    transform: scale(1.15) rotate(5deg);
}

/* ============================================================
   ステップ7専用：350px 垂直タイムラインタワー（完全浄化版）
   ============================================================ */

/* 旧タワーコンテナは非表示に統一 */
#timelineTowerContainer {
    display: none !important;
}

/* Step 7 Tower Mode Scoped Styles */
.tower-mode-active#floodAnimationStatus, 
.tower-mode-active#timelineTower {
    display: none;
    position: fixed !important;
    right: 10px !important;
    top: 5% !important;
    width: 450px; 
    height: 90vh; 
    background: #1e293b !important;
    border: 2px solid #334155 !important;
    border-radius: 12px !important;
    z-index: 100000 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    resize: both;
}

/* タイムラインタワーモード時のみ、標準のシミュレーションコントロールを隠す */
.tower-mode-active#floodAnimationStatus .standard-sim-controls,
.tower-mode-active#floodAnimationStatus .anim-header,
.tower-mode-active#floodAnimationStatus .anim-control-group,
.tower-mode-active#floodAnimationStatus .anim-label,
.tower-mode-active#floodAnimationStatus .nav-buttons-container,
.tower-mode-active#floodAnimationStatus details {
    display: none !important;
}

/* 断面図上部の伸縮ハンドル (爪) */
.chart-resizer-top {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: #3b82f6;
    border-radius: 6px 6px 0 0;
    cursor: ns-resize;
    z-index: 2201;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

.chart-resizer-top::after {
    content: ":::";
    color: white;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    line-height: 1;
    margin-bottom: 2px;
}

.chart-resizer-top:hover {
    background: #2563eb;
}

/* 断面図右下の伸縮ハンドル (両方向) */
.chart-resizer-br {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, transparent 50%, #3b82f6 50%);
    cursor: nwse-resize;
    z-index: 2202;
    border-radius: 0 0 12px 0;
}

.chart-resizer-br::after {
    content: "◢";
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: white;
    font-size: 14px;
    line-height: 1;
}

.chart-resizer-br:hover {
    background: linear-gradient(135deg, transparent 50%, #2563eb 50%);
}

/* ステップ7タワーモード：設定項目を非表示にし、時系列図のみを全画面表示する */
.tower-mode-active#floodAnimationStatus .standard-sim-controls,
.tower-mode-active#floodAnimationStatus .anim-header,
.tower-mode-active#floodAnimationStatus .anim-control-group,
.tower-mode-active#floodAnimationStatus .nav-buttons-container,
.tower-mode-active#floodAnimationStatus details {
    display: none !important; /* 👈 これで設定部分が消えます */
}

#elevationChart canvas {
    max-height: 100% !important;
}


