* {
    box-sizing: border-box;
}

/* 页面整体背景和字体设置 */
html, body {
    background-color: #f0f4ff;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 顶部标题栏样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
    background-color: white;
    border-bottom: 1px solid #888;
}

/* 标题样式 */
.header h1 {
    margin: 0;
    padding-left: 10px;
    padding-right: 10px;
    color: #333;
    font-size: 1.8em;
}

.header button {
    margin: 0;
    padding-right: 16px;
    padding-bottom: 0px;
    background-color: white;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.0em;
    transition: background-color 0.3s, color 0.3s;
}

/* 按钮悬停时的效果 */
.header button:hover {
    text-decoration: underline; 
}

/* 地图容器的布局，左右排列 */
.map-container {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
}

.map-container {
    display: flex;
    justify-content: space-between;
    height: auto;
    margin-top: 2px;
}

.map-container > .map-section-single {
    width: 100%;
    margin-top: 2px;
}

.map-container > .map-section-double {
    width: 49.5%;
    position: relative;
    margin-top: 2px;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: white;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
}

.dropdown-group, .button-group {
    display: flex;
}

.dropdown-group select, .button-group button {
    margin-right: 10px;
}

.dropdown-group select {
    font-size: 12px; /* 调整下拉框字体大小 */
    padding: 5px; /* 增加内边距，确保更好显示 */
    border-radius: 4px; /* 可选，增加圆角效果 */
    border: 1px solid #333; /* 设置边框 */
    background-color: white; /* 确保背景颜色是白色 */
    -webkit-appearance: none; /* 去掉iOS的默认样式 */
    -moz-appearance: none; /* 去掉Firefox的默认样式 */
    appearance: auto; /* 去掉默认样式 */
}

.dropdown-group select:hover {
    background-color: #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.button-group button {
    margin-top: 2px;
    font-size: 12px; /* 调整按钮字体大小 */
    border-radius: 4px; /* 增加圆角效果，改成更大的值使效果更柔和 */
    padding: 4px 4px; /* 调整按钮内边距，使按钮看起来更紧凑 */
    border: 1px solid #333; /* 添加适中的边框 */
    background-color: white; /* 按钮背景色 */
    color: black; /* 按钮文字颜色 */
    transition: background-color 0.3s, color 0.3s; /* 增加过渡效果 */
}

/* 按钮悬停时的效果 */
.button-group button:hover {
    background-color: #eee;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* 地图样式 */
.map {
    flex-grow: 1; /* 地图占满剩余空间 */
    width: 100%;
    height: 75vh;
    margin-top: 4px;
    border: 1px solid #333;
}

/* 显示结果的容器位于地图下方 */
#result {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
}

#result {
    height: 50px;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #333;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.legend {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
}

.legend {
    background-color: white;
    padding: 10px;
    border: 1px solid #333;
    margin-top: 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.legend-title {
    font-weight: bold;
    display: flex;
    white-space: nowrap;
    margin-right: 80px;
}

.legend-items-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    flex-grow: 1;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 30px;
}

.legend-color-box {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 1px solid #ccc;
}

/* 消息样式 */
.message {
    font-size: 16px;
    text-align: center;
    margin-top: 10px;
}
/* 消息颜色 */
.message.info { color: blue; }
.message.error { color: red; }
.message.success { color: green; }
.message.warning { color: orange; }

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        display: flex;
        flex-direction: column; /* 垂直排列 */
        align-items: center; /* 水平居中 */
        justify-content: center; /* 垂直居中 */
    }

    .header h1 {
        font-size: 1.2em;
        text-align: center;
    }

    .header button {
        display: none;
    }

    .map-container {
        flex-direction: column;
    }

    .map-container > .map-section-single {
        width: 100%;
        margin-bottom: 1px;
    }
    
    .map-container > .map-section-double {
        width: 100%;
        margin-bottom: 1px;
    }

    /* 地图样式 */
    .map {
        height: 50vh;
        margin-top: 1px;
    }

    .button-group {
        display: flex;
        flex-wrap: wrap; /* 允许按钮换行 */
        justify-content: flex-start; /* 按钮从左开始排列 */
        width: 100%; /* 使按钮组占满容器宽度 */
    }

    .button-group button {
        margin-right: 10px; /* 按钮之间的间距 */
        margin-bottom: 2px; /* 如果换行，增加按钮之间的间距 */
        width: auto; /* 按钮宽度自动适应 */
    }

    .legend-title {
        display: none;
    }
}