@charset "utf-8";

/* 💡 カラー変数の定義 */
:root {
    --bg-color: #1e293b;
    --panel-bg: #0f172a;
    --border-color: #38bdf8;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --overlay-bg: rgba(15, 23, 42, 0.6);
    --sidebar-bg: rgba(15, 23, 42, 0.95);
}

body.light-mode {
    --bg-color: #f1f5f9;
    --panel-bg: #ffffff;
    --border-color: #0284c7;
    --text-main: #0f172a;
    --text-sub: #475569;
    --overlay-bg: rgba(241, 245, 249, 0.6);
    --sidebar-bg: rgba(255, 255, 255, 0.95);
}

/* 全画面のリセット */
html, body {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-color: var(--bg-color);
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.3s ease;
}

/* 🌟 ヘッダーのデザイン */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    min-height: 56px; /* 💡 height: 56px から min-height に変更 */
    background: var(--panel-bg);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px; /* 💡 上下のパディングを少し縮めて調整 */
    box-sizing: border-box;
    z-index: 9990;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: background-color 0.3s, border-color 0.3s;
    flex-wrap: wrap; /* 💡 万が一溢れても崩壊しないように保険 */
    gap: 10px; /* 💡 要素間の適度な隙間 */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-title {
    color: var(--text-main);
    font-size: clamp(14px, 4vw, 18px); /* 💡 画面幅に合わせて14px〜18pxに自動可変させます */
    margin: 0;
    font-weight: bold;
    letter-spacing: 0.5px;
    transition: color 0.3s;
    white-space: nowrap; /* 💡 勝手に途中で改行されるのを防ぐ */
}

/* 🌟 フッターのデザイン */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 34px;
    background: var(--panel-bg);
    border-top: 1px solid var(--text-sub);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9990;
    padding: 0 15px;
    box-sizing: border-box;
    transition: background-color 0.3s, border-color 0.3s;
}

.footer-copy {
    margin: 0;
    color: var(--text-sub);
    font-size: 11px;
    transition: color 0.3s;
}

/* ライト／ダーク切り替えトグルスイッチ */
.theme-toggle-container {
    position: absolute;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-label {
    font-size: 12px;
    user-select: none;
}

.theme-switch {
    width: 38px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.switch-circle {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

body:not(.light-mode) .theme-switch { background: #007788; }
body:not(.light-mode) .switch-circle { left: 20px; }

/* 🍔 ハンバーガーボタン */
.hamburger-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}
body.light-mode .hamburger-btn span { background: #0f172a; }
.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: #f8fafc;
    margin: 2px 0;
    transition: all 0.3s ease;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }


/* 📂 サイドバーメニュー */
.sidebar {
    position: fixed;
    top: 56px;
    left: -300px;
    width: 280px;
    height: calc(100vh - 56px);
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    z-index: 9999;
    box-shadow: 5px 0 25px rgba(0,0,0,0.15);
    transition: left 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), background-color 0.3s;
    color: var(--text-main);
    overflow-y: auto;
}
.sidebar.open { left: 0; }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--text-sub);
}
.sidebar-header h3 { margin: 0; font-size: 16px; color: #38bdf8; }
body.light-mode .sidebar-header h3 { color: #0284c7; }

/* アコーディオンカテゴリ */
.menu-category { border-bottom: 1px solid var(--bg-color); }
.category-title {
    padding: 15px 20px;
    font-weight: bold;
    background: var(--bg-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.submenu { display: none; background: var(--panel-bg); }
.submenu.active { display: block; }
.submenu-item {
    padding: 12px 30px;
    font-size: 14px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
}
.submenu-item:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--border-color);
    padding-left: 35px;
}

/* ⚙️ 上部コントロールパネル */
.control-panel {
/*    display: none !important; 💡 いったん隠すために非表示化 */
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 2px;
    border-radius: 20px;
}

.control-panel .btn {
    padding: 6px 14px;
    background: transparent;
    color: var(--text-sub);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.2s;
}
.control-panel .btn.active { background: #007788; color: white; }
#btn-edit.active { background: #ff3366; color: white; }

/* 🖼️ 額縁 */
.map-frame {
    position: fixed;
    top: 80px;       /* 💡 71px から 80px に広げて、ヘッダーとの被りを回避 */
    left: 15px;     
    right: 15px;    
    bottom: 49px;    
    
    background: var(--panel-bg); 
    border: 4px solid var(--border-color); 
    border-radius: 16px; 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
    overflow: hidden; 
    z-index: 1;
    transition: border-color 0.3s, background-color 0.3s;
}

.map-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 💡 遮断用の膜 */
.map-overlay {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg); 
    z-index: 99; 
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.3s ease, background-color 0.3s; 
}
.map-overlay.active {
    opacity: 1;           
    pointer-events: auto; 
}

#panzoom-element { 
    position: absolute; 
    top: 0;
    left: 0;
    display: block; 
    transform-origin: left top; 
    touch-action: none;
}

/* 🖼️ マップ画像のサイズ制限を解除し、親のpanzoom要素に完全同期させる */
#map-img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

/* 📌 ピンのデザイン */
.pin {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 50;
    transform-origin: center center;
}
.pin::before, .pin::after {
    content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; top: -5px;
}
.pin::before { left: -5px; }
.pin::after { right: -5px; }

.pin.pin-blue, .pin.pin-blue::before, .pin.pin-blue::after { background-color: #007788 !important; }
.pin.pin-red, .pin.pin-red::before, .pin.pin-red::after { background-color: #ff3366 !important; }
.pin.pin-green, .pin.pin-green::before, .pin.pin-green::after { background-color: #10b981 !important; }
.pin.pin-orange, .pin.pin-orange::before, .pin.pin-orange::after { background-color: #f97316 !important; }
/* 💡 新しいカラーバリエーションの追加 */
.pin.pin-pink, .pin.pin-pink::before, .pin.pin-pink::after { background-color: #ff66b2 !important; }
.pin.pin-purple, .pin.pin-purple::before, .pin.pin-purple::after { background-color: #a855f7 !important; }
.pin.pin-cyan, .pin.pin-cyan::before, .pin.pin-cyan::after { background-color: #06b6d4 !important; }
.pin.pin-yellow, .pin.pin-yellow::before, .pin.pin-yellow::after { background-color: #eab308 !important; }

/* 💡 イエローの時だけ数字が見えやすいように文字色を調整（お好みで） */
.pin.pin-yellow { color: #000000 !important; }



/* 🌟 ポップアップ */
.popup {
    display: none;
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.2);
}

#form-popup { width: 220px; padding: 20px; }
#form-popup h4 { margin: 0 0 12px 0; color: #ff3366; font-size: 15px; }
#form-popup input, #form-popup select, #form-popup textarea {
    width: 92%; margin-bottom: 10px; padding: 6px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 12px;
}
#form-popup select { width: 98%; }
#form-popup textarea { resize: none; }
.popup-buttons { display: flex; justify-content: space-between; margin-top: 5px; }
.popup-buttons button { padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: bold; }
#btn-cancel { background: #e2e8f0; color: #475569; }
#btn-save { background: #ff3366; color: white; }

#mickey-popup { width: 280px; overflow: hidden; }
#popup-img { width: 100%; height: 170px; object-fit: cover; display: block; }
.popup-content { padding: 18px; }
#popup-title { margin: 0 0 8px 0; color: #1e293b; font-size: 16px; font-weight: bold; }
#popup-text { margin: 0; color: #475569; font-size: 13px; line-height: 1.5; }
#close-popup { margin-top: 14px; width: 100%; background: #007788; color: white; border: none; padding: 10px 0; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 13px; }