/* ===================================================================
   全新的 custom.css (全局悬浮 + 高级暗色系主题)
   =================================================================== */

/* --- 1. 全局与地图基础重置 --- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: block; /* 彻底干掉影响地图的 flex */
    font-family: 'Microsoft YaHei', -apple-system, sans-serif;
    user-select: none; /* 防止频繁点击时误选文字 */
}

/* 强制把 Leaflet 默认的灰色底图换成纯白色(根据你的需求保留) */
.leaflet-container {
    background-color: #ffffff !important;
}


/* --- 2. 右下角悬浮按钮 (胶囊形状，带阴影) --- */
.floating-btn {
    position: fixed;
    left: 20px;
    bottom: 25px;
    z-index: 9999;
    background-color: #2b2b2b; /* 暗色底 */
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 50px; /* 圆角胶囊 */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #444;
    transition: all 0.2s ease;
}

.floating-btn:hover {
    background-color: #3d3d3d;
    transform: translateY(-2px); /* 悬浮时微微上浮 */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}


/* --- 3. 筛选弹窗面板 (还原图二暗色质感) --- */
.filter-modal {
    position: fixed;
    left: 20px;
    bottom: 85px; /* 悬浮在按钮正上方 */
    width: 320px;
    max-height: 75vh;
    background-color: #1e1e1e; /* 深灰背景 */
    color: #e0e0e0;
    z-index: 10000;
    border-radius: 12px; /* 大圆角更现代 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    border: 1px solid #333;
    overflow: hidden; /* 防止子元素溢出破坏圆角 */
}

/* 弹窗头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #252525;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #333;
}

/* 关闭按钮 */
.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}
.close-btn:hover { color: #ff5252; } /* 悬停变红提示关闭 */

/* 搜索框 */
.search-box {
    padding: 12px 15px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

.search-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    background: #121212; /* 更深的输入框 */
    border: 1px solid #444;
    color: white;
    border-radius: 6px;
    outline: none;
    font-size: 13px;
    transition: border-color 0.2s;
}

.search-box input:focus { border-color: #4caf50; } /* 聚焦时的绿色边框 */
.search-box input::placeholder { color: #666; }


/* --- 4. 内部滚动列表与分组 --- */
.marker-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* 滚动条美化 */
.marker-list::-webkit-scrollbar { width: 6px; }
.marker-list::-webkit-scrollbar-thumb { background-color: #555; border-radius: 3px; }

/* 分组外框 */
.group { margin-bottom: 12px; }

/* 分组头部 (带折叠功能) */
.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    background-color: #2a2a2a;
    border-radius: 6px;
    transition: background 0.2s;
}
.group-header:hover { background-color: #333; }
.header-title { font-weight: bold; font-size: 14px; color: #fff; }

/* 头部右侧：眼睛与箭头 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-all-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
    transition: color 0.2s;
}
.toggle-all-btn:hover { color: #ddd; }
.eye-icon { width: 14px; height: 14px; opacity: 0.8; filter: invert(1); /* 强制反色让黑图标变白 */}
.arrow { font-size: 12px; color: #666; transition: transform 0.3s; }
.group.active .arrow { transform: rotate(90deg); } /* 展开时的箭头旋转 */

/* 分组内容区 */
.group-content { display: none; padding-top: 8px; }
.group.active .group-content { display: block; }


/* --- 5. 具体的列表项 (图标 + 文字 + 数量) --- */
.item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    background: transparent;
    border-left: 3px solid transparent;
    transition: background 0.1s;
}

.item:hover { background: rgba(255,255,255,0.05); }

/* 选中状态 (主色调变为绿色，与宝可梦精灵球的收集感匹配) */
.item.selected { 
    background: rgba(76, 175, 80, 0.1); 
    border-left: 3px solid #4caf50; 
}

/* 列表前面的首字母小方块/圆圈 */
.item .icon {
    width: 26px; 
    height: 26px; 
    background: #444; 
    border-radius: 6px; 
    text-align: center; 
    line-height: 26px; 
    margin-right: 12px; 
    font-size: 12px;
    font-weight: bold;
    color: #aaa;
}

.item.selected .icon { 
    background: #4caf50; 
    color: #fff;
}

.item .name { flex: 1; font-size: 13px; color: #ccc; }
.item.selected .name { color: #fff; }

.item .count { font-size: 12px; color: #666; }

/* ===================================================================
   新增：左下角控制按钮组与地图切换弹窗
   =================================================================== */

/* 左下角按钮组容器 */
.left-bottom-controls {
    position: fixed;
    margin-bottom: 60px;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 8px; /* 按钮之间的间距 */
    z-index: 9999;
}

/* 仿图一的灰色方块按钮样式 */
.control-btn {
    background-color: rgba(90, 95, 100, 0.85); /* 半透明灰 */
    color: #ffffff;
    border: 1px solid #777;
    padding: 10px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
}

.control-btn:hover {
    background-color: rgba(120, 125, 130, 1);
    color: #fff;
}

/* 地图切换面板专有位置覆盖 (放在左侧) */
.map-modal {
    left: 20px;
    right: auto;
    bottom: 130px; /* 在按钮组的上方 */
    width: 280px; /* 面板稍微窄一点 */
}

/* 地图列表项样式 */
.map-item {
    padding: 12px 15px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    color: #ddd;
    font-size: 14px;
    transition: background 0.2s;
    border-radius: 4px;
    margin-bottom: 4px;
}

.map-item:hover {
    background-color: #333;
    color: #fff;
}

/* 当前所在地图的高亮样式 */
.map-item.active {
    background-color: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    font-weight: bold;
    border-left: 3px solid #4caf50;
}

/* ===================================================================
   新增：地图折叠菜单 (文件夹样式)
   =================================================================== */

/* 折叠组外壳 */
.map-group {
    margin-bottom: 4px;
}

/* 折叠组的头部 (带小箭头) */
.map-group-header {
    padding: 12px 15px;
    background-color: #2a2a2a; /* 背景色稍微区分一下 */
    border-radius: 4px;
    cursor: pointer;
    color: #ddd;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.map-group-header:hover {
    background-color: #383838;
    color: #fff;
}

/* 右侧的旋转小箭头 */
.map-group-header .arrow {
    font-size: 12px;
    color: #888;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 当处于展开状态时，箭头朝下 */
.map-group.expanded .map-group-header .arrow {
    transform: rotate(90deg);
}

/* 子地图容器 (默认隐藏，左侧缩进) */
.map-group-children {
    display: none;
    padding-left: 15px; /* 缩进产生层级感 */
    padding-top: 4px;
}

/* 展开时显示内部楼层 */
.map-group.expanded .map-group-children {
    display: block;
}

/* 特殊处理一下子菜单的单行样式，让它像镶嵌在里面的 */
.map-group-children .map-item {
    background-color: rgba(0, 0, 0, 0.15); /* 更深的背景色 */
    border-bottom: 1px solid #222;
    padding: 10px 15px; /* 高度稍微矮一点点 */
}

.map-group-children .map-item:hover {
    background-color: #333;
}

/* 子菜单是当前地图时的样式微调 */
.map-group-children .map-item.active {
    background-color: rgba(76, 175, 80, 0.15);
}


/* 地图上的纯文字地名标注样式 */
.map-text-label {
    color: #ffffff;
    font-size: 16px; /* 文字大小可自行调节 */
    font-weight: bold;
    font-family: 'Microsoft YaHei', sans-serif;
    text-align: center;
    white-space: nowrap; /* 强制不换行 */
    /* 文字黑色描边，确保在任何颜色的地图上都能看清 */
    text-shadow:
        -1px -1px 0 #000,
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         0px  2px 4px rgba(0,0,0,0.8);
    margin-left: -50%; /* 保证坐标点正好在文字正中间 */
}

/* ===================================================================
   新增：弹窗内部的多图滚动区域样式
   =================================================================== */

/* 限制最大高度并允许上下滚动 */
.popup-media-scroll {
    max-height: 180px; /* 控制滚动区域高度，大约显示 1.5 张图的高度 */
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 10px;
    padding-right: 4px; /* 给右侧滚动条留出一点空间 */
    display: flex;
    flex-direction: column;
    gap: 8px; /* 多张图之间的上下间距 */
}

/* 统一图片宽度并加上圆角 */
.popup-img {
    width: 100%;
    border-radius: 4px;
    cursor: zoom-in; /* 鼠标放上去变成放大镜 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* 给图片加一点轻微的立体阴影 */
    display: block; 
}

/* 美化弹窗内部的滚动条 (变细、变圆滑) */
.popup-media-scroll::-webkit-scrollbar { 
    width: 4px; 
}
.popup-media-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.popup-media-scroll::-webkit-scrollbar-thumb { 
    background-color: #bbb; 
    border-radius: 4px; 
}
.popup-media-scroll::-webkit-scrollbar-thumb:hover {
    background-color: #888; 
}